package xyz.imeans.w.util;

import java.util.Random;

public class XmUtil {
    private XmUtil(){}

    private static final String[] SUR_NAMES_CH = {"赵", "钱", "孙", "李", "周", "吴", "郑", "王", "冯", "陈", "褚", "卫",
            "蒋", "沈", "韩", "杨", "朱", "秦", "尤", "许", "何", "吕", "施", "张", "孔", "曹", "严", "华", "金", "魏", "陶",
            "姜", "全", "任", "廖", "余"};
    private static final String[] SUR_NAMES_EN = {"Smith", "Johnson", "Williams", "Brown", "Jones", "Garcia", "Miller",
            "Davis"};
    private static final String[] GIVEN_NAMES_CH = {"伟", "芳", "娜", "飞", "杰", "敏", "强", "丽", "刚", "静", "勇", "梅",
            "明", "燕", "涛", "军", "辉", "波", "英", "华", "杰", "萍", "磊", "娜", "军", "燕", "勇", "帅", "婷", "峰", "蕾",
            "子涵", "雨婷", "佳怡", "欣怡", "子轩", "俊杰", "思远", "宇航", "梦洁", "雅静", "文博", "欣妍", "煜城", "嘉熙", "瑾萱"};
    private static final String[] GIVEN_NAMES_EN = {"John", "Michael", "William", "David", "Richard", "Charles",
            "Joseph", "Thomas"};

    public static String create(String type) {
        Random random = new Random();
        if("ch".equals(type)) {
            String surname = SUR_NAMES_CH[random.nextInt(SUR_NAMES_CH.length)];
            String givenName = GIVEN_NAMES_CH[random.nextInt(GIVEN_NAMES_CH.length)];
            return surname + givenName;
        } else if("en".equals(type)) {
            String surname = SUR_NAMES_EN[random.nextInt(SUR_NAMES_EN.length)];
            String givenName = GIVEN_NAMES_EN[random.nextInt(GIVEN_NAMES_EN.length)];
            return surname + " " + givenName;
        }
        return null;
    }

}
